package Huffman;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2024/8/24-下午2:28
 * Since  :   1.0
 * Version:   1.0
 */
@Data

public class Node implements Comparable<Node> {

    int value;
    Node leftNode;
    Node rightNode;

    @Override
    public int compareTo(Node o) {
        return this.value-o.value;
    }

    public Node(int value) {
        this.value = value;
    }

    public void midOrder(){
        if (this.leftNode != null) {
            this.leftNode.midOrder();
        }
        System.out.println(this.value);
        if (this.rightNode != null) {
            this.rightNode.midOrder();
        }

    }

}
